import pytest
from filelock import FileLock

from storage.mutex import Mutex


def test_smoking_acquire_release():
    m = Mutex('/test-mutex')
    with m:
        pass


@pytest.mark.benchmark
@pytest.mark.parametrize('lock,name', [
    pytest.param(Mutex, '/mutex', id='mutex'),
    pytest.param(FileLock, 'testdata.lock', id='filelock'),
])
def test_benchmark_exclusive_lock(benchmark, lock, name):
    benchmark(lock, name)
